Component({
  ready() {
    // 在组件实例被创建时执行
    console.log('组件被创建');
    // setTimeout(() => {
    //   this.setData({
    //     list: [{
    //       // index:0,
    //       pagePath: "/pages/xinpin/index",
    //       iconPath: "/images/home/t1.png",
    //       selectedIconPath: "/images/home/t1ch.png",
    //       text: "抢单大厅"
    //     }, {
    //       // index:1,
    //       pagePath: "/pages/fenlei/index",
    //       iconPath: "/images/home/t2.png",
    //       selectedIconPath: "/images/home/t2ch.png",
    //       text: "分类"
    //     }, {
    //       // index:2,
    //       // mid:true,
    //       pagePath: "/pages/home/index",
    //       iconPath: "/images/home/t3c.png",
    //       selectedIconPath: "/images/home/t3c.png",
    //       text: "首页"
    //     }, {
    //       // index:3,
    //       pagePath: "/pages/zhenxuan/index",
    //       iconPath: "/images/home/t4.png",
    //       selectedIconPath: "/images/home/t4ch.png",
    //       text: "甄选"
    //     }, {
    //       // index:4,
    //       pagePath: "/pages/mine/index",
    //       iconPath: "/images/home/t5.png",
    //       selectedIconPath: "/images/home/t5ch.png",
    //       text: "我的"
    //     }]
    //   });
    // }, 3000);
  },
  data: {
    selected: 0,
    color: "#7A7E83",
    selectedColor: "#F08302",
    list: [{
      // index:0,
      pagePath: "/pages/gongdan/index",
      iconPath: "/images/home/t1.png",
      selectedIconPath: "/images/home/t1ch.png",
      text: "就业"
    }, {
      // index:1,
      pagePath: "/pages/fenlei/index",
      iconPath: "/images/home/t2.png",
      selectedIconPath: "/images/home/t2ch.png",
      text: "分类"
    }, {
      // index:2,
      // mid:true,
      pagePath: "/pages/home/index",
      iconPath: "/images/home/t3c.png",
      selectedIconPath: "/images/home/t3c.png",
      text: "首页"
    }, {
      // index:3,
      pagePath: "/pages/zhenxuan/index",
      iconPath: "/images/home/t4.png",
      selectedIconPath: "/images/home/t4ch.png",
      text: "好物"
    }, {
      // index:4,
      pagePath: "/pages/mine/index",
      iconPath: "/images/home/t5.png",
      selectedIconPath: "/images/home/t5ch.png",
      text: "我的"
    }]
  },
  attached() {
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTabgo({ url })
      console.log(data)
      let a = wx.getStorageSync('AccessToken');
      if (a || data.index == 2 || data.index == 3 || data.index == 4) {
        this.setData({
          selected: data.index
        })
      }

    }
  }
})